package Entity;

import Gui.SystemManager;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author CONG
 */
public class SystemTimer extends Thread {

    private SystemManager mainFrame;

    public SystemTimer(SystemManager mainFrame) {
        this.mainFrame = mainFrame;
    }
    @Override
    public void run() {
        try {
            while (true) {
                SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
                Date currentDate = new Date();
                String timer = format.format(currentDate);
                mainFrame.setTitle("Loan Management System " + " - " + timer);
                SystemTimer.sleep(1000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
